function _typeof(obj) {
  '@babel/helpers - typeof';
  return (
    (_typeof =
      'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator
        ? function (obj) {
            return typeof obj;
          }
        : function (obj) {
            return obj &&
              'function' == typeof Symbol &&
              obj.constructor === Symbol &&
              obj !== Symbol.prototype
              ? 'symbol'
              : typeof obj;
          }),
    _typeof(obj)
  );
}
import React from 'react';
import ArrayRender from './ArrayRender';
import LiteralRender from './LiteralRender';
import NumberRender from './NumberRender';
import ObjectRender from './ObjectRender';
import StringRender from './StringRender';

/**
 * 根据数据类型路由
 * @param param0
 * @returns
 */
export default function RouteRender(_ref) {
  var data = _ref.data,
    _ref$depth = _ref.depth,
    depth = _ref$depth === void 0 ? 0 : _ref$depth,
    spaceable = _ref.spaceable;
  if (Array.isArray(data)) {
    return /*#__PURE__*/ React.createElement(ArrayRender, {
      data: data,
      depth: depth,
    });
  }
  if (_typeof(data) === 'object' && data !== null) {
    return /*#__PURE__*/ React.createElement(ObjectRender, {
      data: data,
      depth: depth,
    });
  }
  if (typeof data === 'string') {
    return /*#__PURE__*/ React.createElement(StringRender, {
      data: data,
      depth: depth,
      spaceable: spaceable,
    });
  }
  if (typeof data === 'number') {
    return /*#__PURE__*/ React.createElement(NumberRender, {
      data: data,
      depth: depth,
      spaceable: spaceable,
    });
  }
  if (typeof data === 'boolean') {
    return /*#__PURE__*/ React.createElement(LiteralRender, {
      data: data === true ? 'true' : 'false',
      depth: depth,
      spaceable: spaceable,
    });
  }
  if (data === null) {
    return /*#__PURE__*/ React.createElement(LiteralRender, {
      data: 'null',
      depth: depth,
      spaceable: spaceable,
    });
  }
  if (data === undefined) {
    return /*#__PURE__*/ React.createElement(LiteralRender, {
      data: 'undefined',
      depth: depth,
      spaceable: spaceable,
    });
  }
  return /*#__PURE__*/ React.createElement(LiteralRender, {
    data: data,
    depth: depth,
    spaceable: spaceable,
  });
}
